package search.service.search;

import com.fasterxml.jackson.databind.ObjectMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import org.springframework.stereotype.Component;
import common.dao.elastic.ElasticSearchDao;
//import search.dao.SearchDao;
//import search.domain.AdvancedParameter;
import search.model.query.FullfieldParameter;

import javax.inject.Inject;

import java.io.IOException;

@Component
public class FullfieldSearchService {
    final Logger logger = LoggerFactory.getLogger(FullfieldSearchService.class);

  //  private final SearchDao searchDao;
    private final ObjectMapper mapper;
    private final ElasticSearchDao elasticsearchDao;

    @Inject
    public FullfieldSearchService(//SearchDao searchDao,
                         ElasticSearchDao elasticsearchDao,
                         ObjectMapper mapper) {
        this.mapper = mapper;
        this.elasticsearchDao = elasticsearchDao;
    }

	//*********************************//
	/* 
	* 全域搜索
	*/
    //full filed search
    //use FullfieldParameter to transport params, with POST Method
    public String fullfieldSearch(FullfieldParameter ffpara) {
		String json = "";
        try {
           json = mapper.writeValueAsString(ffpara);
        } catch (IOException e){
           e.printStackTrace();
        }
        return json;
        
    }
}
